<?php
/**
 * A simple description for this script
 *
 * PHP Version 5.2.0 or Upper version
 *
 * @package    Iris
 * @author     Hidehito NOZAWA aka Suin <http://suin.asia>
 * @copyright  2010 Hidehito NOZAWA
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
 *
 */

class Iris_Class_Mail
{
	protected $mHead = array();

	public function __construct()
	{
		mb_language('Ja');
		mb_internal_encoding('UTF-8');
	}

	public function setMailTo($email)
	{
		$this->mMailTo = $email;
	}

	public function setSubject($subject)
	{
		$this->mSubject = $subject;
	}

	public function setContent($content)
	{
		$this->mContent = $content;
	}

	public function setMailFrom($name, $email)
	{
		$this->mHead[] = sprintf('From:%s <%s>', mb_encode_mimeheader($name), $email);
	}

	public function setBCC($email)
	{
		$this->mHead[] = sprintf('Bcc:%s', $email);
	}

	protected function getHeader()
	{
		return implode($this->mHead, "\n");
	}

	public function sendMail()
	{
		return @mb_send_mail($this->mMailTo, $this->mSubject, $this->mContent, $this->getHeader());
	}
}

?>
